package com.example.diarymanger.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/avatars/**")
                .addResourceLocations("file:D:/IDEA-Project/schoolProject/Diary-manger/Diary-manger/avatorPath/");
        // 配置日记图片的资源处理器
        registry.addResourceHandler("/uploads/**")
                .addResourceLocations("file:D:/IDEA-Project/schoolProject/Diary-manger/Diary-manger/imagePath/");
        registry.addResourceHandler("/noteCoverPath/**")
                .addResourceLocations("file:D:/IDEA-Project/schoolProject/Diary-manger/Diary-manger/noteCoverPath/");
        registry.addResourceHandler("/noteImagePath/**")
                .addResourceLocations("file:D:/IDEA-Project/schoolProject/Diary-manger/Diary-manger/noteImagePath/");
    }
}
